package handler

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"yk3.19/api/request"
	"yk3.19/pkg"
)

func BulletAdd(c *gin.Context) {
	var req request.BulletAdd
	err := c.ShouldBind(&req)
	if err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code": 10,
			"msg":  "验证失败",
			"data": err.Error(),
		})
		return
	}
	if !pkg.Text(req.Content) {
		c.JSON(http.StatusOK, gin.H{
			"code": 0,
			"msg":  "弹幕中还有敏感词，无法发送",
			"data": nil,
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "弹幕发送添加成功",
		"data": "ok",
	})
}
